"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _jsxRuntime = require("react/jsx-runtime");

var _icons = require("@ant-design/icons");

var _proProvider = require("@ant-design/pro-provider");

var _proUtils = require("@ant-design/pro-utils");

var _antdV = require("antd-v4");

var _react = require("react");

var defaultCollapseRender = function defaultCollapseRender(collapsed, _, intl, hiddenNum) {
  if (collapsed) {
    return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
      children: [intl.getMessage('tableForm.collapsed', '展开'), hiddenNum && "(".concat(hiddenNum, ")"), (0, _jsxRuntime.jsx)(_icons.DownOutlined, {
        style: {
          marginLeft: '0.5em',
          transition: '0.3s all',
          transform: "rotate(".concat(collapsed ? 0 : 0.5, "turn)")
        }
      })]
    });
  }

  return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
    children: [intl.getMessage('tableForm.expand', '收起'), (0, _jsxRuntime.jsx)(_icons.DownOutlined, {
      style: {
        marginLeft: '0.5em',
        transition: '0.3s all',
        transform: "rotate(".concat(collapsed ? 0 : 0.5, "turn)")
      }
    })]
  });
};
/**
 * FormFooter 的组件，可以自动进行一些配置
 *
 * @param props
 */


var Actions = function Actions(props) {
  var setCollapsed = props.setCollapsed,
      _props$collapsed = props.collapsed,
      collapsed = _props$collapsed === void 0 ? false : _props$collapsed,
      submitter = props.submitter,
      style = props.style,
      hiddenNum = props.hiddenNum;

  var _useContext = (0, _react.useContext)(_antdV.ConfigProvider.ConfigContext),
      getPrefixCls = _useContext.getPrefixCls;

  var intl = (0, _proProvider.useIntl)();
  var collapseRender = (0, _proUtils.omitBoolean)(props.collapseRender) || defaultCollapseRender;
  return (0, _jsxRuntime.jsxs)(_antdV.Space, {
    style: style,
    size: 16,
    children: [submitter, props.collapseRender !== false && (0, _jsxRuntime.jsx)("a", {
      className: getPrefixCls('pro-form-collapse-button'),
      onClick: function onClick() {
        return setCollapsed(!collapsed);
      },
      children: collapseRender === null || collapseRender === void 0 ? void 0 : collapseRender(collapsed, props, intl, hiddenNum)
    })]
  });
};

var _default = Actions;
exports.default = _default;